<template>
	<view class="box">
	
			<image src="https://web.78keji.cn/images/emps.png" mode="widthFix" style="width:582rpx;margin-top: 337rpx;"></image>
		<view class="" style="width: 320rpx;margin: 0 auto;margin-top: 58rpx;">
		<button  shape="circle" open-type="getAuthorize" @getAuthorize="onGetAuthorize" @error="onAuthError" scope='phoneNumber' style="background-color: #206FFF;color: #FFFFFF;border-radius: 40rpx;">一键登录</button>

          
		</view>
			
	

	</view>
</template>

<script setup>
	import {
	wxLogin,
		openSignDecrypt,
	
	
	} from '../../api/index.js'
	 export default {
			data() {
				return {
	
				
	
				};
			},
			onLoad(option) {
			
if(option.a){
	my.setStorageSync({
		key: 'a',
		data:option.a
	})
}
	
			},
 methods: {

	 onAuthError(err){
	      console.log(err)
	 				  
	      },
 	onGetAuthorize() {
 		uni.showLoading({
 			title:"登录中",
 			mask:true
 		})
 		my.getPhoneNumber({
 		    success: (res) => {
 		        let encryptedData = res.response;
 				console.log(encryptedData)
 				openSignDecrypt({
 					encryptedData:JSON.parse(encryptedData).response,
					xcx:1
 				}).then((resx)=>{
 					console.log(resx)
 					uni.hideLoading()
 					this.time=1
 					uni.setStorageSync('phone', resx.data.mobile)
					uni.removeStorageSync('orderNo')
 				uni.navigateTo({
 					url:'/pages/unit/unit'
 				})
 				})
 		     
 		    },
 		    fail: (res) => {
 		        console.log(res);
 				uni.hideLoading()
 		        console.log('getPhoneNumber_fail');
 		    },
 		});
 	
 		
 	},
 },
			onShow(){
			
			}
		}
		
</script>

<style lang="scss" scoped>
.box{
	text-align: center;
}
</style>